import React from 'react';
import {Provider} from 'react-redux';
import {create} from 'dva-core';
import createLoading from 'dva-loading';

import globalModel from '@/models/global';

import Router from './router';

import 'react-native-gesture-handler';

import '@/utils/Toast';

const models = [globalModel];
const app = create(); // 创建dva实例，可传递配置参数。https://dvajs.com/api/#app-dva-opts

app.use(createLoading());

models.forEach(o => {
  app.model(o);
});
app.start(); // 实例初始化
const store = app._store; // 获取redux的store对象供react-redux使用

const App = () => {
  return (
    <Provider store={store}>
      <Router />
    </Provider>
  );
};

export default App;
